package com.youkeda.service;

import com.youkeda.model.Classes;
import com.youkeda.service.impl.ClassesServiceImpl;

import java.util.List;

/**
 * @author xshuai
 */
public interface ClassesService {
    /**
     * add class
     *
     * @param classes
     */
    void add(Classes classes);

    /**
     * get all classes
     *
     * @return
     */
    List<Classes> getAll();

    /**
     * get data of class
     *
     * @param classId
     * @return
     */
    default Classes get(String classId) {
        ClassesService classesService = new ClassesServiceImpl();
        List<Classes> list = classesService.getAll();
        for (Classes c : list) {
            if (c.getId().equals(classId)) {
                return c;
            }
        }
        return null;
    }
}
